package org.jeecg.modules.oms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.oms.entity.XingeProfileCutDetail;
import org.jeecg.modules.oms.mapper.XingeProfileCutDetailMapper;
import org.jeecg.modules.oms.service.IXingeProfileCutDetailService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 新格尔型材详细切割信息服务实现类
 */
@Service
public class XingeProfileCutDetailServiceImpl extends ServiceImpl<XingeProfileCutDetailMapper, XingeProfileCutDetail> implements IXingeProfileCutDetailService {

    @Override
    public boolean deleteByOrderId(String orderId) {
        LambdaQueryWrapper<XingeProfileCutDetail> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(XingeProfileCutDetail::getOrderId, orderId);
        return this.remove(wrapper);
    }

    @Override
    public List<XingeProfileCutDetail> getByProfileMaterialId(String profileMaterialId) {
        LambdaQueryWrapper<XingeProfileCutDetail> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(XingeProfileCutDetail::getProfileMaterialId, profileMaterialId);
        return this.list(wrapper);
    }
    
    @Override
    public List<XingeProfileCutDetail> getByOrderIdAndProfileCode(String orderId, String profileCode) {
        LambdaQueryWrapper<XingeProfileCutDetail> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(XingeProfileCutDetail::getOrderId, orderId)
               .eq(XingeProfileCutDetail::getProfileCode, profileCode)
               .orderByAsc(XingeProfileCutDetail::getSerialNo);
        return this.list(wrapper);
    }
} 